home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual dBase v5.5 / SAMPLES1.PAK / CUSTORD.POP < prev    next >
Text File  |  1995-07-18  |  5KB  |  164 lines

  1. ******************************************************************************
  2. *  PROGRAM:      Custord.pop
  3. *
  4. *  WRITTEN BY:   Borland Samples Group
  5. *
  6. *  DATE:         5/95
  7. *
  8. *  UPDATED:      5/95
  9. *
  10. *  REVISION:     $Revision:   1.2  $
  11. *
  12. *  VERSION:      Visual dBASE
  13. *
  14. *  DESCRIPTION:  This popup file is used by Custord.wfm for performing simple
  15. *                tasks when the right mouse button is clicked in the Custord
  16. *                form.  It can switch from edit to view mode, and also perform
  17. *                clipboard operations on the currently active form control.
  18. *
  19. *  PARAMETERS:   FormObj -- the form to which this menu is attached.
  20. *
  21. *  CALLS:        None
  22. *
  23. *  USAGE:        set procedure to Custord.pop additive
  24. *                form.popupMenu = new CustordPopup(form, "CustordPopup")
  25. *
  26. *******************************************************************************
  27. #include <Messdlg.h>
  28.  
  29. ** END HEADER -- do not remove this line*
  30. * Generated on 05/09/95
  31. *
  32. Parameter FormObj,PopupName
  33. NEW CUSTORDPOPUP(FormObj,PopupName)
  34. CLASS CUSTORDPOPUP(FormObj,PopupName) OF POPUP(FormObj,PopupName)
  35.    this.TrackRight = .T.
  36.    this.Alignment = 1
  37.    this.Top = 0
  38.    this.Left = 0
  39.    this.OnInitMenu = CLASS::ONINITMENU
  40.  
  41.    DEFINE MENU VIEWEDIT OF THIS;
  42.        PROPERTY;
  43.          Text "&Edit",;
  44.          OnClick CLASS::VIEWEDITONCLICK,;
  45.          Shortcut "Ctrl-E"
  46.  
  47.    DEFINE MENU SEPARATOR1 OF THIS;
  48.        PROPERTY;
  49.          Text "",;
  50.          Separator .T.
  51.  
  52.    DEFINE MENU UNDO OF THIS;
  53.        PROPERTY;
  54.          Text "&Undo",;
  55.          Shortcut "Ctrl+Z",;
  56.          OnClick CLASS::UNDO_ONCLICK
  57.  
  58.    DEFINE MENU CUT OF THIS;
  59.        PROPERTY;
  60.          Text "Cu&t",;
  61.          Shortcut "Ctrl+X",;
  62.          OnClick CLASS::CUT_ONCLICK
  63.  
  64.    DEFINE MENU COPY OF THIS;
  65.        PROPERTY;
  66.          Text "&Copy",;
  67.          Shortcut "Ctrl+C",;
  68.          OnClick CLASS::COPY_ONCLICK
  69.  
  70.    DEFINE MENU PASTE OF THIS;
  71.        PROPERTY;
  72.          Text "&Paste",;
  73.          Shortcut "Ctrl+V",;
  74.          OnClick CLASS::PASTE_ONCLICK
  75.  
  76.  
  77.    ****************************************************************************
  78.  
  79.    procedure OnInitMenu
  80.  
  81.    * Enable submenus if the current control is a BROWSE/ENTRYFIELD/EDITOR.
  82.    ****************************************************************************
  83.    private bEditControl
  84.  
  85.    bEditControl = form.activeControl.className $ "BROWSE, ENTRYFIELD, EDITOR";
  86.                   .and. form.curPage.inEditMode
  87.  
  88.    this.Undo.enabled = bEditControl
  89.    this.Cut.enabled = bEditControl
  90.    this.Copy.enabled = bEditControl
  91.    this.Paste.enabled = bEditControl
  92.  
  93.  
  94.    ****************************************************************************
  95.    procedure ViewEditOnClick
  96.  
  97.    * Toggle between View and Edit modes.
  98.    ****************************************************************************
  99.    form.ViewEdit()
  100.  
  101.  
  102.    ****************************************************************************
  103.    Procedure UNDO_OnClick
  104.  
  105.    * Execute Undo() operation if it is a method of the currently active control.
  106.    ****************************************************************************
  107.    private control
  108.  
  109.    control = form.activeControl
  110.    if control.className $ "BROWSE, ENTRYFIELD, EDITOR"
  111.       control.Undo()
  112.    endif
  113.  
  114.  
  115.    ****************************************************************************
  116.    Procedure CUT_OnClick
  117.  
  118.    * Execute Cut() operation if it is a method of the currently active control.
  119.    ****************************************************************************
  120.    private control
  121.  
  122.    control = form.activeControl
  123.    if control.className $ "BROWSE, ENTRYFIELD, EDITOR"
  124.       control.Cut()
  125.    endif
  126.  
  127.  
  128.    ****************************************************************************
  129.    Procedure COPY_OnClick
  130.  
  131.    * Execute Copy() operation if it is a method of the currently active control.
  132.    ****************************************************************************
  133.    private control
  134.  
  135.    control = form.activeControl
  136.    if control.className $ "BROWSE, ENTRYFIELD, EDITOR"
  137.       control.Copy()
  138.    endif
  139.  
  140.  
  141.    ****************************************************************************
  142.    Procedure PASTE_OnClick
  143.  
  144.    * Execute Paste() operation if it is a method of currently active control.
  145.    ****************************************************************************
  146.    private control
  147.  
  148.    control = form.activeControl
  149.    if control.className $ "BROWSE, ENTRYFIELD, EDITOR"
  150.       control.Paste()
  151.    endif
  152.  
  153.  
  154. ENDCLASS
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.